<html>
<head>
		<!--CSS-->
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap-responsive.min.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/datepicker.css"/>		
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/admin-style.css"/>		
</head>
<div class="main-container">
	<div class="login_form_warp">
		<div class="navbar navbar-inverse">
              <div class="navbar-inner">
                <div class="container">			
					  <a class="brand" href="#"><img style="width:75%;" src="<?php echo base_url() ?>assets/img/stratus_logo.png">
						<span style="position:absolute;font-size:12px;margin:8px 0 0 5px;color:#fff !important;">CMS</span>
					  </a>
				</div>
			</div>
		</div>		
		<div class="form-horizontal">
		<div class="alert" id="error-div" style="display:none;">
			
		</div>
			<div class="control-group">
				<label class="control-label label-login" for="strCMSUserName">Username:</label>
				<div class="controls">
					<input type="text" id="username" name="strCMSUserName" placeholder="Username" />
				</div>
			</div>
			<div class="control-group">
				<label class="control-label label-login" for="strCMSUserPassword">Password:</label>
				<div class="controls">
					<input type="password" id="password" name="strCMSUserPassword" placeholder="Password" />
				</div>
			</div>

			<div class="control-group">
				<div class="controls">
					<button id="submit-btn" class="btn" >Login</button>
				</div>

			</div>
		</div>
	</div>
</div>
<!--Javascript-->
<script type="text/javascript" src="<?php echo base_url().'assets/js/jquery.min.js';?>"></script>
<script type="text/javascript" src="<?php echo base_url().'assets/js/bootstrap.min.js';?>"></script>
<script type="text/javascript" src="<?php echo base_url().'assets/js/bootstrap-datepicker.js';?>"></script>
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>

<!-- Add fancyBox -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/lib/fancybox/source/jquery.fancybox.css?v=2.1.4" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.4"></script>

<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.5"></script>

<link rel="stylesheet" href="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo base_url(); ?>assets/lib/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
<script type="text/javascript">
	var loader = "<img src='<?php echo base_url() ?>assets/img/ajax-loader.gif' >";
	var base_url = "<?php echo base_url() ?>";

	$(document).ready(function() {
		$("#submit-btn").live('click',function(e){
			submit_login();
		});
	

		$('input').keydown(function(e) {
			  if(e.keyCode == 13) {
				 submit_login();
			  }
		});
	});
	
	//functions 
	
	function submit_login(){
			var data_sent =
					{
						'strCMSUserName':$('#username').val(),
						'strCMSUserPassword':$('#password').val()
					};
			
			$.ajax({ 
				type: "POST", // request type POST
				url: base_url+"admin/login", // post to PHP file
				data: data_sent, // request send to PHP file
				dataType:'json',
				success: function(result){ // result = return from php request					
					if(result.message == 'Valid')
					{
						document.location = base_url+'admin';
					}
					else
					{
						$("#error-div").html(result.message);
						$("#error-div").fadeIn();
					}
					
				}
			});
	}
</script>